import unittest
import time
# from tools.HTMLTestRunner import HTMLTestRunner
# from Finance_fun.scripts.test01_register import RegiterTest
# from Finance_fun.scripts.test02_login import LoginTest
from Finance_fun.scripts.test03_transaction import TransactionTest
from Finance_fun.scripts.test04_my_red_envelope import My_Red_EnvelopeTest
from Finance_fun.scripts.test05_my_investment import MyInvestmentTest
from Finance_fun.scripts.test06_my_collection_plan import MyCollectionPlanTest
from Finance_fun.scripts.test07_base_info import BaseInfoTest
from Finance_fun.scripts.test08_remind_setting import RemindSettingTest
from Finance_fun.scripts.test09_my_promotion import MyPromotionTest
from Finance_fun.scripts.test10_promotion_record import PormotionRecordTest
from Finance_fun.tool.HTMLTestReport import HTMLTestReport




# 定义测试套件
# suite = unittest.defaultTestLoader.discover("../scripts", pattern=".py")
suite = unittest.TestSuite()
# suite.addTest(unittest.makeSuite(TransactionTest))
# suite.addTest(unittest.makeSuite(My_Red_EnvelopeTest))
# suite.addTest(unittest.makeSuite(MyInvestmentTest))
# suite.addTest(unittest.makeSuite(MyCollectionPlanTest))
# suite.addTest(unittest.makeSuite(BaseInfoTest))
# suite.addTest(unittest.makeSuite(RemindSettingTest))
# suite.addTest(unittest.makeSuite(MyPromotionTest))
suite.addTest(unittest.makeSuite(PormotionRecordTest))


# 定义报告存放路径及存放名称
report_dir = "../report/P2P_FunReport_{}.html".format(time.strftime("%Y_%m_%d %H_%M_%S"))


# 获取文件流并执行
with open(report_dir, "wb") as f:
    HTMLTestReport(stream=f, title="金融项目自动化测试报告", description="功能测试",tester="第一小组").run(suite)